package com.crowntit.domain.activity.service.trail.thread;

import com.crowntit.domain.activity.adapter.repository.IActivityRepository;
import com.crowntit.domain.activity.model.entity.ScSkuEntity;
import com.crowntit.domain.activity.model.valobj.SkuVO;

import java.util.concurrent.Callable;

public class QuerySkuVOThreadTask implements Callable<SkuVO> {

    private final String goodsId;
    private final String source;
    private final String channel;

    private final IActivityRepository activityRepository;

    public QuerySkuVOThreadTask(String goodsId, String source, String channel, IActivityRepository activityRepository) {
        this.goodsId = goodsId;
        this.source = source;
        this.channel = channel;
        this.activityRepository = activityRepository;
    }

    @Override
    public SkuVO call() throws Exception {
        return activityRepository.querySkuByScGoodsId(ScSkuEntity.builder()
                .goodsId(goodsId)
                .source(source)
                .channel(channel)
                .build());
    }
}
